import { IBaseTable } from './atom/db/interfaces';
import update from './atom/db/update';

declare const action_id: string;
declare const session_id: string;
declare const spaceid: string;

interface Message {
}

interface FruitPrices extends IBaseTable {
	name: string;
	price: number;
}

async function atom(msg: Message) {
	const { exec, prepare } = update(action_id, session_id, spaceid, '1000');
	prepare<FruitPrices>('fruitprices', [{ _id: 'xxx', name: '番茄', price: 5.5 }]);
	const ret = await exec();
	if (ret.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
